< previous page page_32 next page >

Page 32
   If ScaleWidth < ScaleHeight Then
      Radius = ScaleWidth / 2
   Else
      Radius = ScaleHeight / 2
   End If

   SetupPoints points, Radius, ScaleWidth / 2, ScaleHeight / 2
   Call Polyline(hdc, PointArray(), points)
   ' Switch to the next of the 16 standard colors
   CurrentColorIndex = (CurrentColorIndex + 1) Mod 16
   Me.ForeColor = QBColor(CurrentColorIndex)
End Sub

Private Sub Form_Load()
   Randomize
End Sub

Private Sub Timerl_Timer()
   ' Draw using the current settings
   cmdDraw Click
   ' And set a new point count for next time
   txtPoints.Text = Int(Rnd() * 50) + 5
End Sub
0032-01.gif
Figure P7-3:
The actual image drawn by the program looks nothing 
like the desired result
Results
The Polyline function is very fast. You can see this by clicking on the Auto button and watching the drawing update itself.
You could, that is, except that the actual results you will see when you click the Draw Shape button may range from an empty form to something like Figure P7-3.
Can you fix the program?

 
< previous page page_32 next page >